<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    ul {
      list-style: none;
    }

    div {
      width: 1000px;
      height: 460px;
      border: solid 2px yellow;
      margin: 0 auto;

      ul {
        width: 1000px;

        li {
          width: 200px;
          overflow: hidden;
          float: left;
          transition: all 1s;
        }
      }
    }
  </style>
</head>

<body>
  <div>
    <ul>
      <li><img src="./images/1.webp" alt="" /></li>
      <li><img src="./images/2.webp" alt="" /></li>
      <li><img src="./images/3.webp" alt="" /></li>
      <li><img src="./images/4.webp" alt="" /></li>
      <li><img src="./images/5.webp" alt="" /></li>
    </ul>
  </div>
</body>
<script>
  window.onload = function () {
    var div = document.querySelector("div");
    var ul = document.querySelector("ul");
    var lis = ul.children;
    console.log(lis);
    lis.forEach(function (currentValue, index, arr) {
      const item = lis[index];
      item.onmousemove = function () {
        lis.forEach(function (currentValue, index, arr) {
          lis[index].style.width = '60px';

        })
        item.style.width = '760px';
      };
      item.onmouseleave = function () {
        lis.forEach(function (currentValue, index, arr) {
          lis[index].style.width = '200px';

        })

      };

    })


    // for (var i = 0; i < lis.length; i++) {
    //   const item = lis[i];

    //   item.onmousemove = function () {
    //     for (var j = 0; j < lis.length; j++) {
    //       lis[j].style.width = "60px";
    //     }
    //     item.style.width = "760px";
    //   };

    //   item.onmouseleave = function () {
    //     for (var k = 0; k < lis.length; k++) {
    //       lis[k].style.width = "200px";
    //     }
    //   };
    // }
  };
</script>

</html>